import torch
import numpy as np
import argparse
import yaml

parser = argparse.ArgumentParser(description="Process a YAML configuration file.")
parser.add_argument('config_path', 
                    type=str, 
                    nargs='?', 
                    default='./config/mlp.yaml', 
                    help='Path to the YAML configuration file')

args = parser.parse_args()

with open(args.config_path, 'r') as file:
        config = yaml.safe_load(file)

print("Configuration loaded:")
print(config)


# 固定种子
seed = config['seed']
torch.manual_seed(seed)
np.random.seed(seed)
torch.backends.cudnn.deterministic = True


def main():
    from exp import Exp
    main_exp = Exp(config)
    main_exp.train()
    main_exp.test()


if __name__ == '__main__':
    main()
    
